<template>
  <div class="check-radio-container">
    <ul class="check-radio-box">
        <li class="check-radio-item" v-for="(item, index) in requirementTypes" :key="item.id" @change="taggleCheck(item.id)">
            <button :style="{ backgroundColor: getBackgroundColor(index) }">
            {{ item.type }}
            </button>
        </li>
    </ul>
  </div>
</template>

<script setup lang='ts'>
import { ref } from 'vue';

const requirementTypes = [
    {
        id: 1,
        type: "需求",
    },
    {
        id: 2,
        type: "维护",
    },
    {
        id: 3,
        type: "优化",
    },
    {
        id: 4,
        type: "修复",
    },
];

const getBackgroundColor = (index: number) => {
    const colors = ['#367FCB', '#74BF50', '#C81818', '#18ABC8', '#68d29f', '#b96bb6', '#fa5858'];
    return colors[index % colors.length];
}

const taggleCheck = (id: number) => {
    
}
</script>
<style lang='scss' scoped>
.check-radio-box {
    width: 300px;
    height: 40px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    .check-radio-item, button {
        width: 60px;
        border: 1px solid #eee;
        cursor: pointer;
        border-radius: 3px;
        color: white;
        background-color: white;
    }
}
</style>